﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Interop.Security.AzRoles;

namespace System.Management.HyperV.AzMan
{
    public class HypervAzManStore
    {
        public static readonly string DefaultInitialStorePath = @"c:\ProgramData\Microsoft\Windows\Hyper-V\InitialStore.xml";

        private readonly IAzApplication2 theHypervAzManStore;

        public HypervAzManStore()
        {
            var azMan = new AzManStore();
            theHypervAzManStore = azMan.GetStore(DefaultInitialStorePath);
        }

        public string[] GetRoleList()
        {
            var azRoles = AzManStore.GetRoles(theHypervAzManStore);

            var roles = from r in azRoles
                        select r.Name;

            return roles.ToArray();
        }
    }
}